#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>
#include<string.h>
#define FILE_NAME "log.txt"
int main()
{
    
    int fd=open(FILE_NAME,O_RDONLY);
    if(fd<0)
    {
        perror("open");
        return 1;
    }
    dup2(fd,0);
    //printf("hello printf");
    //fprintf(stdout,"hello fprintf");
    char buffer[1024];
    fread(buffer,1,1024,stdin);
    /*buffer[sizeof(buffer)-1]='\0';
    buffer[sizeof(buffer)-2]='\0';
    printf("%d",sizeof(buffer));
    printf("%d",strlen(buffer));
    printf("%s",buffer);
    //fprintf(stdout,"fd:%d\n",fd);
    //fprintf(stdout,"stdout->fd:%d\n",stdout->_fileno);
    //fflush(stdout);
    close(fd);*/
    printf("%s",buffer);
    return 0;
}
